package leetcode.leetcode_3000;

class Solution {
    public int areaOfMaxDiagonal(int[][] dimensions) {
        int maArea= 0;
        long maxLength = 0;
        for (int i = 0; i < dimensions.length; i++) {
            int x = dimensions[i][0];
            int y = dimensions[i][1];
            long length = x*x+y*y;
            if(length > maxLength){
                maxLength = length;
                maArea = x*y;
            }
            else if(length == maxLength){
                maArea = Math.max(maArea, x*y);
            }
        }
        return maArea;
    }
}